<?php defined('BASEPATH') OR exit('No direct script access allowed');?>

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>会员登陆</title>
		<meta name="description" content="User login page" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<!-- bootstrap & fontawesome -->
		<?php echo css_url('bootstrap');?>
		<?php echo css_url('font-awesome');?>
		<!-- text fonts -->
		<?php echo css_url('ace-fonts');?>
		<!-- ace styles -->
		<?php echo css_url('ace');?>
		<!--[if lte IE 9]>
			<?php echo css_url('ace-part2');?>
		<![endif]-->
		<?php echo css_url('ace-rtl');?>
		<!--[if lte IE 9]>
		  <?php echo css_url('ace-ie');?>
		<![endif]-->
		<?php echo css_url('fox');?>
		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!--[if lt IE 9]>
		<?php echo js_url('html5shiv');?>
		<?php echo js_url('respond');?>
		<![endif]-->
		<script type="text/javascript">
		var baseurl='<?php echo base_url()?>';
		var siteurl='<?php echo site_url()?>';
		var sitedomain='<?php echo get_domain()?>';
		</script>
	</head>

	<body>
		<div class="main-container">
			<div class="row">
				<div class="col-sm-12">
					<div style="padding:10px 20px 0;">
					<?php echo csrf_hidden();?>										
					<fieldset>
						<label class="block clearfix">
							<span class="block input-icon input-icon-right">
								<input type="text" class="form-control" placeholder="帐号/手机号/邮箱" id="username" name="username" value="<?php echo set_value('username'); ?>" />
								<i class="ace-icon fa fa-user"></i>
							</span>
						</label>
						<label class="block clearfix">
							<span class="block input-icon input-icon-right">
								<input type="password" class="form-control" placeholder="请输入密码" id="password" name="password" value="<?php echo set_value('password'); ?>" />
								<i class="ace-icon fa fa-lock"></i>
							</span>
						</label>
						<div class="space-6"></div>
						
						<div class="clearfix">
							<button type="submit" class="btn btn-block btn-sm pull-right btn-info">
								<i class="ace-icon fa fa-check"></i>
								<span class="bigger-110">确定登陆</span>
							</button>
						</div>
					</fieldset>
					</div>
				</div><!-- /.col -->
			</div><!-- /.row -->
		</div><!-- /.main-container -->
		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<?php echo jjs_url('jquery');?>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<?php echo jjs_url('jquery1x');?>");
</script>
<![endif]-->
<script type="text/javascript">
	if('ontouchstart' in document.documentElement) document.write("<?php echo jjs_url('jquery.mobile.custom');?>");
</script>

<!-- inline scripts related to this page -->
<script type="text/javascript">
	jQuery(function($) {
		$(document).on('click', '.toolbar a[data-target]', function(e) {
			e.preventDefault();
			var target = $(this).data('target');
			$('.widget-box.visible').removeClass('visible');//hide others
			$(target).addClass('visible');//show target
		});
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.iframeAuto(index);
		 $(document).on('click','[type=submit]',function(){
			var csrf_v = $("#<?php echo csrf_name();?>").val();
			var username = $("#username").val();
			var password = $("#password").val();
			$.ajax({ 
				url:baseurl+'index.php/user/check_login/', 
				type : "POST", 
				data : {'username':username,'password':password,'<?php echo csrf_name();?>':csrf_v},
				success:function(data){ 
					var data = jQuery.parseJSON(data);
					if(data.status == 0){ 
						layer.msg(data.msg, {time: 1000,shade: [0.2, '#393D49']}, function(){						
							$(".<?php echo csrf_name();?>").val(data.code);	
							parent.$(".<?php echo csrf_name();?>").val(data.code);	
							//parent.layer.closeAll();
						});
						
					} else if(data.status == 1){  
						layer.msg(data.msg, {time: 2000,shade: [0.2, '#393D49']}, function(){	
							parent.window.location.reload();
						});
					} 
				} 
			})
		 });
	});
</script>
<?php echo js_url('bootstrap');?>
<?php echo js_url('layer');?>
</body>
</html>
